/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { KStringPtr, KBoolean, RuntimeType, runtimeType, isResource, isInstanceOf } from "@koalaui/interop"
import { NodeAttach, remember } from "@koalaui/runtime"
import { ComponentBase } from "./ComponentBase"
import { TypeChecker } from "#components"
import { ArkCommonMethodComponent } from "./ArkCommon"
import { ArkTabContentPeer } from "./peers/ArkTabContentPeer"
import { UseEventsProperties } from "./use_properties"
import { CommonMethod, CustomBuilder } from "./ArkCommonInterfaces"
import { TabContentAttribute, TabBarOptions } from "./ArkTabContentInterfaces"
import { Resource } from "./ArkResourceInterfaces"
import { SubTabBarStyle } from "./ArkSubTabBarStyleBuilder"
import { BottomTabBarStyle } from "./ArkBottomTabBarStyleBuilder"
import { VoidCallback } from "./ArkUnitsInterfaces"
/** @memo:stable */
export class ArkTabContentComponent extends ArkCommonMethodComponent {
    getPeer(): ArkTabContentPeer {
        return (this.peer as ArkTabContentPeer)
    }
    /** @memo */
    public setTabContentOptions(): this {
        if (this.checkPriority("setTabContentOptions")) {
            this.getPeer()?.setTabContentOptionsAttribute()
            return this
        }
        return this
    }
    /** @memo */
    public tabBar(value: SubTabBarStyle | BottomTabBarStyle | string | Resource | CustomBuilder | TabBarOptions): this {
        if (this.checkPriority("tabBar")) {
            const value_type = runtimeType(value)
            if (((((RuntimeType.OBJECT) == (value_type)) && (TypeChecker.isSubTabBarStyle(value))) || (((RuntimeType.OBJECT) == (value_type)) && (TypeChecker.isBottomTabBarStyle(value))))) {
                const value_casted = value as (SubTabBarStyle | BottomTabBarStyle)
                this.getPeer()?.tabBar1Attribute(value_casted)
                return this
            }
            if (((((RuntimeType.STRING == value_type))) || (isResource(value)) || (((RuntimeType.FUNCTION == value_type))) || (TypeChecker.isTabBarOptions(value, false, false)))) {
                const value_casted = value as (string | Resource | CustomBuilder | TabBarOptions)
                this.getPeer()?.tabBar0Attribute(value_casted)
                return this
            }
            throw new Error("Can not select appropriate overload")
        }
        return this
    }
    /** @memo */
    public onWillShow(value: VoidCallback): this {
        if (this.checkPriority("onWillShow")) {
            const value_casted = value as (VoidCallback)
            this.getPeer()?.onWillShowAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onWillHide(value: VoidCallback): this {
        if (this.checkPriority("onWillHide")) {
            const value_casted = value as (VoidCallback)
            this.getPeer()?.onWillHideAttribute(value_casted)
            return this
        }
        return this
    }
    public applyAttributesFinish(): void {
        // we calls this function outside of class, so need to make it public
        super.applyAttributesFinish()
    }
}

/** @memo */
export function ArkTabContent(
  /** @memo */
  style: ((attributes: ArkTabContentComponent) => void) | undefined,
  /** @memo */
  content_: (() => void) | undefined,
  
) {
    const receiver = remember(() => {
        return new ArkTabContentComponent()
    })
    NodeAttach<ArkTabContentPeer>((): ArkTabContentPeer => ArkTabContentPeer.create(receiver), (_: ArkTabContentPeer) => {
        receiver.setTabContentOptions()
        style?.(receiver)
        content_?.()
        receiver.applyAttributesFinish()
    })
}
